<?php
/*
 * MiniMe - a minimalistic OStatus complient microblogging tool
 * Copyright (C) 2010, Tuomas Koski - koski.tuomas@gmail.com
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * <author>
 *  <name>testkoski</name>
 *  <uri>http://identi.ca/user/209172</uri>
 * </author>
 * 
 * @author     Tuomas Koski <koski.tuomas@gmail.com>
 * @copyright  Tuomas Koski
 * @license    http://www.gnu.org/licenses/lgpl.txt
 */
class Mm_Atom_Element_Author extends Mm_Xml_Element_Parent {
    
    const ELEMENT_NAME = 'name';
    const ELEMENT_URI  = 'uri';
    const ELEMENT_OBJECT_TYPE = 'objectType';
    const ELEMENT_LINK_PHOTO = 'photo';
    
    protected $tagname = "author";
    
    public function __construct(array $childElements) {
        parent::__construct($childElements);
        
        if(!isset($this->childElements[self::ELEMENT_OBJECT_TYPE])) {
            $this->addChildElement(self::ELEMENT_OBJECT_TYPE, 
                                   new Mm_Atom_Element_ActivityStream_ObjectType(
                                   Mm_Atom_Element_ActivityStream_ObjectType::TYPE_PERSON
                                   ));
        }
    }
    
    /**
     * @return Mm_Atom_Element_Uri
     */
    public function getUri() {
        return $this->getChildElement(self::ELEMENT_URI);
    }
    
	/**
     * @return Mm_Atom_Element_Name
     */
    public function getName() {
        return $this->getChildElement(self::ELEMENT_NAME);
    }
}